# -*- coding:utf-8 -*-
# @Time:2024/4/1921:01
# @Author:miuzg
# @FileName:new test2.py
# @Software:PyCharm
import requests
url = "https://www.baidu.com/s"
kw = {'wd':'2024奥运会'}
res = requests.get(url,params=kw)
res.encoding = 'utf-8'
print(res.encoding,end='\n`````````````\n')
print(res.text,end='\n`````````````\n')
print(res.headers,end='\n`````````````\n')

html = res.text
with open('baidu.html','w',encoding='utf-8')as f:
    f.write(html)